Learn R Programming

ncdfCF (version 0.1.1)

[[,ncdfDataset-method: Get a variable object or a dimension object from a dataset

Description

This method can be used to retrieve a variable or a dimension from the dataset by name.

Usage

# S4 method for ncdfDataset
[[(x, i)

Value

An instance of ncdfVariable or an ncdfDimension descendant class, or NULL if the name is not found.

Arguments

x

An ncdfDataset to extract a variable or a dimension from.

i

The name of a variable or dimension in x.

Examples

Run this code
fn <- system.file("extdata", "ERA5land_Rwanda_20160101.nc", package = "ncdfCF")
ds <- open_ncdf(fn)
v1 <- names(ds)[1]
var <- ds[[v1]]
var

Run the code above in your browser using DataLab